The present invention relates generally to computer software, and more particularly, to a program structure and a method and apparatus for creating a computer program.
A computer program is a set of instructions or operations for a computer to perform. The computer program is typically stored on a computer readable medium accessible by the computer, such as a storage area or memory of the computer. The computer can retrieve an instruction from memory, perform the instruction, retrieve the next instruction, and so forth. The storage area can also contain data that is operated on by the instructions.
A computer program can be generally classified as an interactive program or as a batch program. An interactive program xe2x80x9cinteractsxe2x80x9d with a user in that the program can require input from the user and can provide an output to the user. An example of an interactive program is a Web browser.
A batch program is designed to run without interaction with the user. A batch program can be started, for example, by a user through the use of an interactive program, or can be set to run automatically at a certain time. Once started, the batch program will run without requiring user interaction. Examples of batch programs include printing requests and certain computationally intensive numerical analysis programs.
A computer program is typically created in a high-level computing language, such as Fortran 90, C, C++, etc. Statements written in the high-level computing language form a source code file, which can be compiled (by an appropriate compiler) into an object file. The source code file is a human-readable form of the computer program, while the object file is in a machine language. The machine language can be optimized to work with a particular computer architecture (e g, a particular central processing unit (CPU) with its specific logic architecture and set of possible computer instructions). Alternatively, the machine language can be designed to run on any computer platform having the appropriate interpreter (e.g., Java virtual machine).
Many applications require the use of both interactive and batch programs. For example, in the data processing arena, an interactive program can be used in a front-end to interface directly with a user. A batch program can then be run in the back-end to perform the actual data processing functions requested by the user. The front-end program can interact directly with the back-end program or can use an intermediate program (e.g., an application program interface (API)) that mediates the front-end and back-end activities. The front-end program and the back-end program can be running on computers that are remotely located with respect to each other, or can be running on the same computer system.
The front-end program and the back-end program are required to interact with each other, such that the user""s instructions to the front-end program are carried out by the back-end program. The front-end program and the back-end program, however, are different programs, which are often written by different programmers. For example, the front-end program can be designed to operate with a graphical user interface (GUI) to provide for ease of interfacing with a user. Thus, a programmer familiar with the intricacies of the GUI may be employed to write the front-end program. The back-end program, however, needs no user interface, as it typically interacts with either the front-end program or an API.
Computer programs are frequently modified to implement changes, add enhancements, or correct errors. Each time a computer program is modified, the programmer edits the source code file of the computer program. However, the source code file is not the only file that needs to be edited. The programmer is usually required (e.g., by a corporate software policy) to update a documentation file with relevant programming comments. Updates to a user documentation file may also be needed, especially if the modification to the computer program adds a new feature. A GUI file associated with the computer program may also be updated if the modification to the computer program impacts the GUI. Further, any modification to a front-end program can have a tremendous impact on the back-end program, in terms of the parameters that may be passed from the front-end program to the back-end program. As such, the back-end program may also need to be modified to work correctly with the new front-end program. Thus, even a small modification to a computer program can require the modification of a significant number of files.
As apparent from the above-described deficiencies, a need exists for program structure, a method, and an apparatus that allows a computer program to be modified, without the need for modifying a number of other files.
One aspect of the present invention is directed to a computer program, stored on a computer readable medium and executable by a computer system. The computer system has a front-end for interfacing with a user, and a back-end for performing batch functions. The computer program comprises instructions for performing a function. The function is adapted to run on the back-end of the computer system and requires at least one parameter for its operation. The computer program further comprises instructions for validating the parameter, which are adapted to run on both the front-end and the back-end of the computer system. The computer program also comprises graphical user interface information for creating a graphical user interface, which can be used to receive the parameter, and is adapted to run on the front-end of the computer system. The computer program still further comprises a documentation section for providing information related to the function, which is adapted for display via the graphical user interface. The instructions for validating the parameter can be used on the front-end to validate the parameter as it is entered via the graphical user interface and, additionally can be used on the back-end to validate the parameter before it is submitted as part of a batch program.
Another aspect of the present invention is directed to a method and apparatus for creating computer-executable instructions from a computer program. The computer program includes a source code section, a documentation section, and a graphical user interface section The source code section is compiled to create instructions for performing a function and instructions for validating a parameter associated with the function The graphical user interface section is extracted and used to create a graphical user interface, which can be used to receive the parameter. The documentation section is extracted for display via the graphical user interface.
Yet another aspect of the present invention is directed to a method and apparatus for creating computer executable instructions from a computer program. The computer program includes a source code section, a documentation section, and a graphical user interface section. The source code section is first compiled with a first compiler to create a first set of executable code adapted to run on a back-end of a computer system. The first set of executable code includes instructions for performing a function, and instructions for validating a parameter associated with the function. The source code section is compiled with a second compiler to create a second set of executable code adapted to run on a front-end of the computer system. The second set of executable code includes instructions for validating the parameter. The graphical user interface definition section is extracted and a graphical user interface is created therefrom for receipt of the parameter. The documentation section is extracted for display via the graphical user interface.